<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path;
    String reportPath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + "/report";
%>
<!DOCTYPE html>
<html>
<fmt:bundle basename="text">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>设备详情</title>
        <link href="<%=basePath%>/images/favicon.ico" rel="shortcut icon"/>
            <%-- rem.js --%>
        <script src="<%=basePath%>/js/rem.js"></script>
        <link rel="stylesheet" href="<%=basePath%>/bootstrap/css/bootstrap.min.css">
        <link rel="stylesheet" href="<%=basePath%>/css/font-awesome.min.css">
        <link rel="stylesheet" href="<%=basePath%>/dist/css/AdminLTE.min.css">
        <link rel="stylesheet" href="<%=basePath%>/dist/css/skins/_all-skins.min.css">
        <link rel="stylesheet" href="<%=basePath%>/plugins/viewer/viewer.min.css">
        <link rel="stylesheet" type="text/css" href="<%=basePath%>/pagination/style/pagination.css" media="screen">

        <!-- iziModal -->
        <link rel="stylesheet" href="<%=basePath%>/plugins/iziModal/css/iziModal.min.css">

        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
        <![endif]-->
        <link rel="stylesheet" href="<%=basePath%>/toastr/toastr.css"/>
        <style>
            .pTitle {
                font-weight: bold;
                font-size: 0.32rem;
                line-height: 0.36rem;
                color: #14bf9b;
                border-left: 3px solid #14bf9b;
                padding-left: 0.2rem;
            }

            #assetsPresentation .szqk {
                border-left: 1px dashed #fff;
            }

            #assetsPresentation .change-chart label {
                margin: 0 0.2rem;
                cursor: pointer;
            }

            #assetsPresentation .change-chart label i {
                margin-right: 0.1rem;
            }

            #assetsPresentation .change-chart label.active i {
                color: #0d6aad;
                font-weight: normal;
            }
            .diff-table {
                overflow: auto;
            }
        </style>
        <link rel="stylesheet" href="<%=basePath%>/plugins/charts/css/device-detail.css">
    </head>
    <!-- ADD THE CLASS sidedar-collapse TO HIDE THE SIDEBAR PRIOR TO LOADING THE SITE -->
    <body class="hold-transition skin-blue sidebar-mini">
    <!-- Site wrapper -->
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-md-2 left-part">
                <div class="box box-primary">
                    <div class="box-body box-profile">
                        <h4 style="font-size: 0.32rem;">基本信息</h4>
                        <span class="text-style"><i class="fa fa-keyboard-o margin-r-5"></i>资产名称</span>
                        <p class="impor-info"><span id="assetsNameText"></span></p>
                        <hr>
                        <span class="text-style"><i class="fa fa-indent margin-r-5"></i>资产编号</span>
                        <p class="impor-info"><span id="assetsNoText"></span></p>
                        <hr>
                        <span class="text-style"><i class="fa fa-list-alt margin-r-5"></i>资产型号</span>
                        <p class="impor-info"><span id="assetsModelText"></span></p>
                        <hr>
                        <span class="text-style"><i class="fa fa fa-th margin-r-5"></i>资产序列号</span>
                        <p class="impor-info"><span id="assetsSnText"></span></p>
                        <hr>
                        <span class="text-style"><i class="fa fa-map-marker margin-r-5"></i> 当前位置</span>
                        <p class="impor-info"><span id="locationText"></span></p>
                        <hr>
                        <span class="text-style"><i class="fa fa-pencil margin-r-5"></i>设备状态</span>
                        <p class="impor-info"><span id="assetsStatusText"></span></p>
                        <hr>
                        <span class="text-style"><i class="fa fa-clock-o margin-r-5"></i>购买日期</span>
                        <p class="impor-info"><span id="buyDataText"></span></p>
                        <hr>
                        <span class="text-style"><i class="fa fa-clock-o margin-r-5"></i>安装日期</span>
                        <p class="impor-info"><span id="installText"></span></p>
                        <hr>
                        <span class="text-style"><i class="fa fa-user" style="margin-right: 0.2rem"></i>负责人</span>
                        <p class="impor-info"><span id="ownerText"></span></p>
                        <hr>
                        <span class="text-style"><i class="fa fa-cog" style="margin-right: 0.2rem"></i>保修状况</span>
                        <p class="impor-info"><span id="guaranteeText"></span></p>
                        <hr>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
            <div class="col-md-10 right-part">
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#assetsPresentation" data-toggle="tab" class="underline">运行报告</a></li>
                        <li><a href="#timeline" data-toggle="tab" class="underline">重大事件</a></li>
                        <li><a href="#info" data-toggle="tab" class="underline">资产信息</a></li>
                        <li><a href="#file" data-toggle="tab" class="underline">文件与图片
                            <!-- <span class="badge bg-teal pull-right"></span> --></a></li>
                        <li><a href="#contract" data-toggle="tab" class="underline">合同记录
                            <!-- <span class="badge bg-teal pull-right"></span> --></a></li>
                        <li><a href="#other-tab" data-toggle="tab" class="underline">其他</a></li>
                    </ul>
                    <div class="tab-content ">
                        <!-- 设备运行报告 -->
                        <div class="active tab-pane" id="assetsPresentation">
                            <div class="col-md-5">
                                <p class="pTitle"><span>运行报告</span></p>
                                <div class="col-md-12" style="border-bottom: 1px dashed #fff;position:relative;min-height:3.6rem;">
                                    <div class="col-md-9" id="chartA" style="padding: 0;"></div>
                                    <div class="col-md-3" style="text-align: center;position:absolute;top:50%;right:0.2rem;transform: translate(0, -50%)">
                                        <p class="total-num"
                                           style="display: inline-block;text-align: left;line-height: 0.64rem;font-size: 0.28rem;">
                                            <label class="nowrap"><a onclick="getMatainTimes(1)" class="underline" style="cursor: pointer;">维修次数</a>：<span id="repair-time"></span></label>
                                            <label class="nowrap"><a onclick="getMatainTimes(4)" class="underline"
                                                      style="cursor: pointer;">强检次数</a>：<span id="compulsory-time"></span></label>
                                            <label class="nowrap"><a onclick="getMatainTimes(2)" class="underline" style="cursor: pointer;">保养次数</a>：<span id="upkeep-time"></span></label>
                                            <label class="nowrap"><a onclick="getMatainTimes(3)" class="underline"
                                                      style="cursor: pointer;">巡检次数</a>：<span id="inspection-time"></span></label>
                                            <label class="nowrap"><a onclick="getMatainTimes(5)" class="underline" style="cursor: pointer;">校正次数</a>：<span id="correction-time"></span></label>
                                        </p>
                                    </div>
                                </div>
                                <div class="clearfix"></div>
                                <p class="pTitle" style="margin-top:0.2rem;"><span>运行数据</span></p>
                                <div class="col-md-12">
                                    <div class="col-md-12" style="margin-bottom: 0.4rem;">
                                        <div class="col-md-4">
                                            <p class="nowrap">服务项次</p>
                                            <span style="font:700 0.32rem/0.32rem '';" id="fwxCText"></span>
                                        </div>
                                        <div class="col-md-4">
                                            <p class="nowrap">标准使用年限</p>
                                            <span style="font:700 0.32rem/0.32rem '';" id="useTimeText"></span>
                                        </div>
                                        <div class="col-md-4">
                                            <p class="nowrap">已使用年限</p>
                                            <span style="font:700 0.32rem/0.32rem '';" id="repairCostText"></span>
                                        </div>
                                    </div>
                                    <div class="col-md-12">
                                        <div class="col-md-4">
                                            <p>服务人次</p>
                                            <p><span id="fwrCText" style="font-weight: 700;font-size: 18px;"></span></p>
                                        </div>
                                        <div class="col-md-4">
                                            <p class="nowrap">维修成本</p>
                                            <span style="font:700 0.32rem/0.32rem '';" id="putUseTimeText"></span>
                                        </div>
                                        <div class="col-md-4">
                                            <p class="nowrap">故障时间</p>
                                            <span style="font:700 0.32rem/0.32rem '';" id="validDayText"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-7 szqk">
                                <p class="pTitle"><span>收支情况</span></p>
                                <div class="col-md-12" id="chartB" style="height:7.0rem"></div>
                                <div class="change-chart"
                                     style="text-align: center;padding-bottom: 0.4rem;border-bottom: 1px dashed #fff;">
                                    <label class="active" chart="performance"><i
                                            class="fa fa-circle-thin"></i>绩效图表</label>
                                    <label chart="repair"><i class="fa fa-circle-thin"></i>维修图表</label>
                                </div>
                                <p class="pTitle" style="margin-top:0.2rem;"><span>收支情况</span></p>
                                <div class="col-md-12 text-left" style="font-size: 0.28rem">
                                    <div class="col-md-12" style="margin-bottom: 0.4rem;">
                                        <div class="col-md-4">
                                            <p>今年收入</p>
                                            <span style="font:700 0.32rem/0.32rem '';" id="cur-income"></span>
                                        </div>
                                        <div class="col-md-4">
                                            <p>去年收入</p>
                                            <span style="font:700 0.32rem/0.32rem '';" id="last-income"></span>
                                        </div>
                                        <div class="col-md-4 text-center">
                                            <p>同比</p>
                                            <span style="font:700 0.32rem/0.32rem '';" id="income-yoy"></span>
                                        </div>
                                    </div>
                                    <div class="col-md-12">
                                        <div class="col-md-4">
                                            <p>今年支出</p>
                                            <span style="font:700 0.32rem/0.32rem '';" id="cur-expenditure"></span>
                                        </div>
                                        <div class="col-md-4">
                                            <p>去年支出</p>
                                            <span style="font:700 0.32rem/0.32rem '';" id="last-expenditure"></span>
                                        </div>
                                        <div class="col-md-4 text-center">
                                            <p>同比</p>
                                            <span style="font:700 0.32rem/0.32rem '';" id="expenditure-yoy"></span>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <table class="table table-striped table-bordered">

                            </table>
                        </div>
                        <div class="tab-pane" id="info">
                            <table class="table table-striped table-bordered" id="myTable">
                                <tbody></tbody>
                            </table>
                        </div>
                        <!-- 文件管理 -->
                        <div class="tab-pane" id="file" style="min-height: 12.0rem">
                            <table class="table table-striped table-bordered">
                                <tbody>
                                <tr class="whit-bg">
                                    <th class="text-center text-muted">文件类型</th>
                                    <th class="text-center text-muted">文件名</th>
                                    <th class="text-center text-muted">签发时间</th>
                                    <th class="text-center text-muted">到期时间</th>
                                    <th class="text-center text-muted">文件大小</th>
                                    <th class="text-center text-muted">创建时间</th>
                                    <th class="text-center text-muted">备注</th>
                                </tr>
                                </tbody>
                            </table>
                            <div class="row margin-bottom" id="image-list">
                                <h4 class="text-info" style="padding-left: 0.3rem"><span>设备图片</span></h4>
                            </div>
                        </div>
                        <!-- 合同  -->
                        <div class="tab-pane table-responsive" id="contract" style="min-height: 12.0rem">
                            <div class="diff-table">
                                <p><span>合同列表</span></p>
                                <table class="table table-striped table-bordered">
                                    <tbody>
                                    <tr class="white-bg">
                                        <%--<th class="text-center text-muted">详情</th>--%>
                                        <th class="text-center text-muted">合同名称</th>
                                        <th class="text-center text-muted">合同编号</th>
                                        <th class="text-center text-muted">甲方</th>
                                        <th class="text-center text-muted">乙方</th>
                                        <th class="text-center text-muted">合同类型</th>
                                        <th class="text-center text-muted">签定时间</th>
                                        <th class="text-center text-muted">合同内容</th>
                                        <th class="text-center text-muted">合同有效日期</th>
                                        <th class="text-center text-muted">合同金额(元)</th>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="tab-pane table-responsive" id="other-tab" style="min-height: 12.0rem">
                            <div id="allot-list" class="diff-table">
                                <p><span>调拨记录</span></p>
                                <table class="table table-striped table-bordered">
                                    <tbody>
                                    <tr class="white-bg">
                                        <th class="text-center text-muted">申请日期</th>
                                        <th class="text-center text-muted">申请科室</th>
                                        <th class="text-center text-muted">申请人</th>
                                        <th class="text-center text-muted">申请设备</th>
                                        <th class="text-center text-muted">调出科室</th>
                                        <th class="text-center text-muted">审核人</th>
                                        <th class="text-center text-muted">审核时间</th>
                                        <th class="text-center text-muted">确认时间</th>
                                        <th class="text-center text-muted">状态</th>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div id="train-list" class="diff-table">
                                <p><span>培训记录</span></p>
                                <table class="table table-striped table-bordered">
                                    <tbody>
                                    <tr class="white-bg">
                                        <th class="text-center text-muted">培训时间</th>
                                        <th class="text-center text-muted">培训单位</th>
                                        <th class="text-center text-muted">培训人</th>
                                        <th class="text-center text-muted">培训地点</th>
                                        <th class="text-center text-muted">参加人员</th>
                                        <th class="text-center text-muted">培训内容</th>
                                        <th class="text-center text-muted">备注</th>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div id="attachment-list" class="diff-table">
                                <p><span>附件列表</span></p>
                                <table class="table table-striped table-bordered">
                                    <tbody>
                                    <tr class="white-bg">
                                        <th class="text-center text-muted">附件名称</th>
                                        <th class="text-center text-muted">附件型号</th>
                                        <th class="text-center text-muted">附件编号</th>
                                        <th class="text-center text-muted">备注</th>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <!-- 维修  -->
                        <div id="repair-modal" style="display: none">
                            <div id="repair-list" class="diff-table table-1 hide">
                                <h4 style="color:#15b997;text-align:center;">维修记录</h4>
                                <table class="table table-striped table-bordered" style="margin-bottom:0;">
                                    <tbody>
                                    <tr class="white-bg">
                                        <th class="text-center text-muted" style="width: 1.0rem">详情</th>
                                        <th class="text-center text-muted">报修时间</th>
                                        <th class="text-center text-muted">故障时间</th>
                                        <th class="text-center text-muted">修复时间</th>
                                        <th class="text-center text-muted">状态</th>
                                        <th class="text-center text-muted">故障描述</th>
                                        <th class="text-center text-muted">维修费用(元)</th>
                                        <th class="text-center text-muted">维修商</th>
                                        <th class="text-center text-muted">备件名称</th>
                                        <th class="text-center text-muted">维修工时</th>
                                        <th class="text-center text-muted">评分</th>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div id="upkeep-list" class="diff-table table-2 hide">
                                <!--保养-->
                                <h4 style="color:#15b997;text-align:center;">保养记录</h4>
                                <table class="table table-striped table-bordered" style="margin-bottom:0;">
                                    <tbody>
                                    <tr class="white-bg">
                                       <%-- <th class="text-center text-muted" style="width: 1.0rem">详情</th>--%>
                                        <th class="text-center text-muted">保养时间</th>
                                        <th class="text-center text-muted">保养人</th>
                                        <th class="text-center text-muted">保养内容</th>
                                        <th class="text-center text-muted">保养评价</th>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div id="inspection-list" class="diff-table table-3 hide">
                                <!--巡检-->
                                <h4 style="color:#15b997;text-align:center;">巡检记录</h4>
                                <table class="table table-striped table-bordered" style="margin-bottom:0;">
                                    <tbody>
                                    <tr class="white-bg">
                                        <%--<th class="text-center text-muted">操作</th>--%>
                                        <th class="text-center text-muted">巡检日期</th>
                                        <th class="text-center text-muted">巡检单位</th>
                                        <th class="text-center text-muted">备注</th>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div id="compulsory-list" class="diff-table table-4 hide">
                                <!--强检-->
                                <h4 style="color:#15b997;text-align:center;">强检记录</h4>
                                <table class="table table-striped table-bordered" style="margin-bottom:0;">
                                    <tbody>
                                    <tr class="white-bg">
                                        <%--<th class="text-center text-muted">操作</th>--%>
                                        <th class="text-center text-muted">强检日期</th>
                                        <th class="text-center text-muted">强检单位</th>
                                        <th class="text-center text-muted">强检人</th>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div id="correction-list" class="diff-table table-5 hide">
                                <h4 style="color:#15b997;text-align:center;">校正记录</h4>
                                <table class="table table-striped table-bordered" style="margin-bottom:0;">
                                    <tbody>
                                    <tr class="white-bg">
                                        <th class="text-center text-muted">校正日期</th>
                                        <th class="text-center text-muted">校正单位</th>
                                        <th class="text-center text-muted">校正人</th>
                                        <th class="text-center text-muted">校正报告</th>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <!-- /.tab-pane -->
                        <div class="tab-pane" id="timeline" style="min-height: 12.0rem">
                            <!-- The timeline -->
                            <ul class="timeline timeline-inverse" id="timeAxis">
                            </ul>
                        </div>
                    </div>
                </div>
                <!-- /.tab-content -->
            </div>
            <!-- /.nav-tabs-custom -->
        </div>

        <!-- iziModal模态窗口 -->
        <div id="x-modal" style="z-index:999999">
            <!-- 模态窗口的内容 -->
        </div>
        <div id="pdf-modal"></div>
    </section>
    <!-- ./wrapper -->

    <script src="<%=basePath%>/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <script src="<%=basePath%>/bootstrap/js/bootstrap.min.js"></script>
    <script src="<%=basePath%>/plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <script src="<%=basePath%>/plugins/fastclick/fastclick.js"></script>
    <script src="<%=basePath%>/dist/js/app.min.js"></script>
    <script src="<%=basePath%>/dist/js/demo.js"></script>
    <script src="<%=basePath%>/bootstrapvalidator/js/bootstrapValidator.min.js"></script>
    <script src="<%=basePath%>/toastr/toastr.js"></script>
    <script src="<%=basePath%>/js/common.js"></script>
    <script src="<%=basePath%>/pagination/js/jquery.pagination.min.js"></script>
    <script src="<%=basePath%>/plugins/qrcode/jquery.qrcode.js"></script>
    <script src="<%=basePath%>/plugins/qrcode/qrcode.js"></script>
    <script src="<%=basePath%>/plugins/iziModal/js/iziModal.min.js"></script>
    <script src="<%=basePath%>/plugins/pdfobject/pdfobject.js"></script>
    <script src="<%=basePath%>/plugins/viewer/viewer.min.js"></script>
    <script src="<%=basePath%>/echarts/echarts.min.js"></script>
    <script type="text/javascript">
        // DeviceId
        var deviceId = GetQueryString('deviceId') ? GetQueryString('deviceId') : location.pathname.split("/")[location.pathname.split("/").length-2];

        var CONST = 1000000;

        $(document).ready(function () {
            try {
                menuCss("医疗设备");
            } catch(err) {
                console.log(err);
            }
            initChart();
            setRaderChart();
            setPerformanceChart();
            deviceInfo();
            bindEvent();
        });

        function bindEvent() {
            $('#assetsPresentation .change-chart label').on('click', function () {
                $(this).addClass('active').siblings().removeClass('active');
                if ($(this).attr('chart') == 'performance') {
                    setPerformanceChart();
                } else {
                    setRepairChart();
                }
            });
        }

        var chartA, chartB;

        function initChart() {
            $('#chartA').height($('#chartA').width());
            chartA = echarts.init(document.getElementById('chartA'));
            chartB = echarts.init(document.getElementById('chartB'));
        }

        // 设置雷达图及数据
        function setRaderChart() {
            var planUpkeepCounts = 10,
                realUpkeepCounts = 0,
                planInspectionCounts = 10,
                realInspectionCounts = 0,
                plancompulsoryCounts = 10,
                realcompulsoryCounts = 0,
                correctionCounts = 10,
                repairCounts = 0,
                maxRepairCounts = 10;
            $.ajax({
                url: '<%=reportPath%>/charts/overview/assets/fields',
                type: 'POST',
                dataType: 'json',
                data: {deviceId: deviceId},
                success: function (data) {
                    if (data.ret) {
                        planUpkeepCounts = parseInt(data.data.radar.planUpkeepCounts || 0);
                        realUpkeepCounts = parseInt(data.data.radar.realUpkeepCounts || 0);
                        planUpkeepCounts = planUpkeepCounts < realUpkeepCounts ? realUpkeepCounts : planUpkeepCounts;
                        planInspectionCounts = parseInt(data.data.radar.planInspectionCounts || 0);
                        realInspectionCounts = parseInt(data.data.radar.realInspectionCounts || 0);
                        planInspectionCounts = planInspectionCounts < realInspectionCounts ? realInspectionCounts : planInspectionCounts;
                        plancompulsoryCounts = parseInt(data.data.radar.plancompulsoryCounts || 0);
                        realcompulsoryCounts = parseInt(data.data.radar.realcompulsoryCounts || 0);
                        plancompulsoryCounts = plancompulsoryCounts < realcompulsoryCounts ? realcompulsoryCounts : plancompulsoryCounts;
                        correctionCounts = parseInt(data.data.radar.correctionCounts || 0);
                        repairCounts = parseInt(data.data.radar.toRepairCounts || 0);
                        maxRepairCounts = parseInt(data.data.radar.maxRepairCounts || 0);
                        maxRepairCounts = maxRepairCounts < repairCounts ? repairCounts : maxRepairCounts;

                        //运行数据跟收支情况
                        var dataobj = data.data.fileds;
                        if(dataobj.ret == 200){
                            var infoObj = dataobj.data;
                            var fwrc = infoObj.fwrc == null ? '　' : infoObj.fwrc; //服务人次
                            var fwxc = infoObj.fwxc == null ? '　' : infoObj.fwxc; //服务人次
                            var standardUsefulLife = infoObj.standardUsefulLife == null ||  infoObj.standardUsefulLife  == 0 ? '　' : infoObj.standardUsefulLife + "年"; //标准使用年限
                            var alreadyUsefulLife = infoObj.alreadyUsefulLife == null ? '　' : infoObj.alreadyUsefulLife + "年";//已使用年限
                            var totalFee = infoObj.totalFee == null ? '　' : infoObj.totalFee/100; //维保费用
                            var profit = infoObj.profit == null ? '　' : (infoObj.profit+"%");//利润点
                            var faultTime = infoObj.faultTime == null? '　' : infoObj.faultTime;  //故障时间

                            var thisYearIncomeFwsr = infoObj.thisYearIncomeFwsr == null ? '　' : infoObj.thisYearIncomeFwsr/100;  //今年收入
                            var oldYearIncomeFwsr = infoObj.oldYearIncomeFwsr == null ? '　' : infoObj.oldYearIncomeFwsr/100;  //去年收入
                            var fwsrBasis = infoObj.fwsrBasis == null ? '　' : parseFloat(infoObj.fwsrBasis).toFixed(2); //收入同期比
                            var thisYearPayFee = infoObj.thisYearPayFee == null ? '　' : infoObj.thisYearPayFee/100;   //今年支出
                            var oldYearPayFee = infoObj.oldYearPayFee == null? '　' : infoObj.oldYearPayFee/100;    //去年支出
                            var payBasis = infoObj.payBasis == null ? '　' : parseFloat(infoObj.payBasis).toFixed(2);        //支出同期比

                            //运行数据
                            $('#fwxCText').text(showNumber(fwxc,"次"));
                            $('#fwrCText').text(showNumber(fwrc,"次"));
                            $("#useTimeText").text(standardUsefulLife);
                            $("#repairCostText").text(alreadyUsefulLife);
                            $("#putUseTimeText").text(showNumber(totalFee,"元"));
                            $("#faultTimeText").text(profit);
                            $("#validDayText").text(showDate(faultTime));

                            //收支情况
                            $("#cur-income").text(showNumber(thisYearIncomeFwsr,"元"));
                            $("#last-income").text(showNumber(oldYearIncomeFwsr,"元"));
                            $("#income-yoy").text(fwsrBasis+"%");
                            $('#cur-expenditure').text(showNumber(thisYearPayFee,"元"));
                            $('#last-expenditure').text(showNumber(oldYearPayFee,"元"));
                            $('#expenditure-yoy').text(payBasis+"%");
                        }
                    }
                    $('#repair-time').text(repairCounts + '次');
                    $('#upkeep-time').text(realUpkeepCounts + '次');
                    $('#compulsory-time').text(realcompulsoryCounts + '次');
                    $('#inspection-time').text(realInspectionCounts + '次');
                    $('#correction-time').text(correctionCounts + '次');

					optionA.radar.indicator[0].max = 20;
                    optionA.radar.indicator[1].max = 20;
                    optionA.radar.indicator[2].max = 20;
                    optionA.radar.indicator[3].max = 20;
                    optionA.radar.indicator[4].max = 20;
					optionA.series[0].data[0].value = [0, 0, 0, 0, 0];
                    optionA.series[0].data[1].value = [repairCounts, realcompulsoryCounts, correctionCounts, realUpkeepCounts, realInspectionCounts];
                    chartA.clear();
                    chartA.setOption(optionA);
                }
            });
        }

        function showNumber(number,unit){
            var str = "　";
            if(number == null || number == "　"){
                return '0.00' + unit;
            }
            if(number > 10000){
                str = parseFloat(number/10000).toFixed(2) + "万" + unit;
            }else{
                str = number.toFixed(2) + unit;
            }
            return str;
        }

        function showDate(number){
            var str = "　";
            if(number == null || number == "　"){
                return '0.00';
            }
            if(number > 60){
                str = parseFloat(number/60).toFixed(2) + "小时";
            }else{
                str = number +"分钟";
            }
            return str;
        }

        // 绩效图表
        function setPerformanceChart() {
            var xAxis = [];
            var curIncome = [];
            var curExpenditure = [];
            $.ajax({
                url: '<%=reportPath%>/charts/overview/assets/performance/month',
                type: 'POST',
                dataType: 'json',
                data: {deviceId: deviceId},
                success: function (data) {
                    var list = ((data.data || {}).data || {}).list || [];
                    if (data.ret && data.data && list.length > 0) {
                        for (var i = 0; i < list.length; i++) {
                            xAxis.push(list[i].name);
                            curIncome.push((parseFloat(list[i].curIncome || 0) / CONST).toFixed(2));
                            curExpenditure.push((parseFloat(list[i].curExpenditure || 0) / CONST).toFixed(2));
                        }
                    }
                    optionB1.xAxis[0].data = xAxis;
                    optionB1.series[0].data = curIncome;
                    optionB1.series[1].data = curExpenditure;
                    chartB.clear();
                    chartB.setOption(optionB1);
                }
            });
        }

        // 维修图表
        function setRepairChart() {
            var xAxis = [];
            var curRepairCost = [];
            var curToRepairCounts = [];
            $.ajax({
                url: '<%=reportPath%>/charts/overview/assets/repair/year',
                type: 'POST',
                dataType: 'json',
                data: {deviceId: deviceId},
                success: function (data) {
                    if (data.ret == 1 && data.data && data.data.list.length > 0) {
                        for (var i = 0; i < data.data.list.length; i++) {
                            xAxis.push(data.data.list[i].name);
                            curRepairCost.push((parseFloat(data.data.list[i].curRepairCost || 0) / CONST).toFixed(2));
                            curToRepairCounts.push(parseInt(data.data.list[i].curToRepairCounts || 0));
                        }
                    }
                    optionB2.xAxis[0].data = xAxis;
                    optionB2.series[0].data = curRepairCost;
                    optionB2.series[1].data = curToRepairCounts;
                    chartB.clear();
                    chartB.setOption(optionB2);
                }
            });
        }


        var obj = {statusIcon: 'fa fa-clock-o', statusColor: '#5082eb'};

        function differStatuIcon(text) {
            if (text.indexOf("设备报修") > -1) {
                obj.statusIcon = "fa fa-wrench";
                obj.statusColor = "#f9b229";
            } else if (text.indexOf("设备保养") > -1) {
                obj.statusIcon = "fa fa-cogs";
                obj.statusColor = "#82ca2b";
            } else if (text.indexOf("巡检处理") > -1) {
                obj.statusIcon = "fa fa-rocket";
                obj.statusColor = "#10458f";
            } else if (text.indexOf("强检处理") > -1) {
                obj.statusIcon = "fa fa-codiepie";
                obj.statusColor = "#eaaaf1";
            } else {
                obj.statusIcon = "fa fa-clock-o";
                obj.statusColor = "#5082eb";
            }
            return obj;
        }

        //查询时间轴
        function deviceInfo() {
            $.ajax({
                url: '<%=basePath%>/charts/overview/device/info',
                type: 'POST',
                dataType: 'json',
                data: {deviceId: deviceId},
                async: false,
                success: function (data) {
                    if (data.ret == 1) {
                        /* 左侧栏基本信息 */
                        var deviceInfo = data.data.deviceInfo;
                        if (deviceInfo.ret) {
                            deviceInfo = deviceInfo.data.list;
                            $('#assetsNameText').text(deviceInfo.assetsName || '');
                            $('#assetsNoText').text(deviceInfo.eidt_assetsNo || '');
                            $('#assetsModelText').text(deviceInfo.eidt_model || '');
                            $('#assetsSnText').text(deviceInfo.eidt_sn || '');
                            $('#locationText').text(deviceInfo.eidt_location || '');
                            $('#assetsStatusText').text(deviceInfo.eidt_assetsStatus || '');
                            $('#buyDataText').text(deviceInfo.eidt_purchaseDate || '');
                            $('#installText').text(deviceInfo.eidt_installDate || '');
                            $('#ownerText').text(deviceInfo.eidt_responsiblePerson || '');
                            $('#useTimeText').text((deviceInfo.eidt_usefulLife || 0) + '年');
                            $('#validDayText').text(data.data.presentation.data.assetsPresentation.working_time ? (data.data.presentation.data.assetsPresentation.working_time + '天') : '');
                            $('#faultTimeText').text((data.data.presentation.data.assetsPresentation.fault_time || 0) + '小时');
                            $('#guaranteeText').text(function () {
                                if (deviceInfo.eidt_warrantyEnd
                                        && deviceInfo.eidt_warrantyStart
                                        && Date.parse(new Date()) >= Date.parse(deviceInfo.eidt_warrantyStart)
                                        && Date.parse(new Date()) <= Date.parse(deviceInfo.eidt_warrantyEnd)) {
                                    return '保修期内';
                                } else {
                                    return '保修期外';
                                }
                            } ());
                        }

                        /* 时间轴 */
                        $("#timeAxis").html("");
                        var timeLineData = data.data.assetsTimeLine;
                        if (timeLineData.ret == 1) {
                            timeLineData = timeLineData.data;
                            for (var i = 0; i < timeLineData.length; i++) {
                                differStatuIcon(timeLineData[i].item);
                                $("#timeAxis").append("<li><i class='" + obj.statusIcon + "' style=';color: #fff;background: " + obj.statusColor + "'></i>" +
                                    "<div class='timeline-item'>" +
                                    "<h3 class='timeline-header' style='background: #fff'>" +
                                    "<span style='color: #000'>" + (timeLineData[i].time == null ? "" : timeLineData[i].time) + "</span>" +
                                    "</h3>" +
                                    "<div class='timeline-body'>" + timeLineData[i].detail + "</div>" +
                                    "<div id='imgUrl" + i + "'></div>" +
                                    "</div>" +
                                    "</li>");
                                // 追加图片信息
                                if (timeLineData[i].imgUrl != null) {
                                    $("#imgUrl" + i).html("");
                                    var result = timeLineData[i].imgUrl.split(",");
                                    for (var j = 0; j < result.length - 1; j++) {
                                        $("#imgUrl" + i).append("<img style = 'width:2.0rem;height:0.6rem;' src='" + result[j] + "' alt='Visa'> &nbsp;");
                                    }
                                    $("#imgUrl" + i).viewer("destroy");
                                    $("#imgUrl" + i).viewer();
                                }
                            }
                            // 结束
                            $("#timeAxis").append("<li><i class='fa fa-clock-o bg-gray'></i></li>");
                        }

                        /* 资产信息 */
                        var field_classify_list = data.data.field_classify;
                        if(field_classify_list.ret == 200){
                            var title_list = field_classify_list.data;
                            $.each(title_list,function (index,item) {
                                var count = 0;
                                var basic = [];
                                var a = '';
                                if(item.id == 32000  ){
                                    a = 'fa-minus'
                                }else {
                                    a = 'fa-plus'
                                }
                                var html = ' <tr class="'+item.id + item.code+' info" data-class="'+item.id + item.code+'">'+
                                    '<td colspan="6" class="text-left col-md-12 info" style="background-color: #272625">' +
                                    '<label>&nbsp;&nbsp;'+item.item+'</label>' +
                                    '<div class="pull-right">'+
                                    '<button type="button" class="btn btn-box-tool"><i class="fa '+(a)+'" id="togle-tool"></i>'+
                                    '</button>'+
                                    '</div>' +
                                    '</td>'+
                                    '</tr>';

                                $("#myTable").find("tbody").append(html);



                                var info = data.data.deviceInfo;
                                if (info.ret == 200) {
                                    var list1 = info.data.customFields;
                                    var list2 = info.data.list;
                                    $.each(list1, function (key, val) {
                                        if(val.fieldClassify == item.id){
                                            if(val.fieldName == "id"){
                                            }else{
                                                basic.push({
                                                    'fieldName': val.fieldName,
                                                    'value': list2[val.aliasName]
                                                });
                                                count++;
                                            }
                                        }
                                    });

                                    if(count == 0){
                                        $("."+item.id + item.code).remove();
                                    }
                                    var baseicHtml =  basicTrHtml(basic,item.id,item.code);
                                    $("#myTable").find("tbody").append(baseicHtml);
                                }
                            })
                            $('#myTable').on('click','#togle-tool',function () {
                                if($(this).hasClass('fa-minus')){
                                    $(this).removeClass('fa-minus');
                                    $(this).addClass('fa-plus');
                                    var length = $(this).parents('tr').next('tr').attr('data-length');
                                    var arr = $(this).parents('tr').nextAll('tr');
                                    var arr1 = arr.slice(0,length);
                                    $.each(arr1,function (key,val) {
                                        $(val).hide();
                                    })
                                }else {
                                    $(this).removeClass('fa-plus');
                                    $(this).addClass('fa-minus');
                                    var length = $(this).parents('tr').next('tr').attr('data-length');
                                    var arr = $(this).parents('tr').nextAll('tr');
                                    var arr1 = arr.slice(0,length);
                                    $.each(arr1,function (key,val) {
                                        $(val).show();
                                    })
                                }
                            })
                        }

                        /* 文件与图片、合同记录、其他 */
                        var fullInfo = data.data.deviceFull;
                        if (fullInfo.ret) {
                            fullInfo = fullInfo.data;
                            /* 文件 */
                            var fileAssetsList = fullInfo.fileAssetsList;
                            if (fileAssetsList.length) {
                                for (var i = 0; i < fileAssetsList.length; i++) {
                                    $('#file').find('table tbody').append('<tr>' +
                                        '<th class="text-center text-muted">' + (fileAssetsList[i].fileTypeName || '') + '</th>' +
                                        '<td class="text-center text-aqua underline" style="cursor:pointer;" onclick="preview(\'' + (fileAssetsList[i].fileUrl || '') + '\',\'' + (fileAssetsList[i].fileName || '') + '\')">' + (fileAssetsList[i].fileName || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (fileAssetsList[i].fileDateStart || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (fileAssetsList[i].fileDateEnd || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (fileAssetsList[i].fileSizeStr || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (fileAssetsList[i].createDate || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (fileAssetsList[i].remark || '') + '</td>' +
                                        '</tr>');
                                }
                            } else {
                                $('#file').find('table tbody').html('<tr><td class="text-center text-muted" colspan="7">暂无数据！</td></tr>');
                            }

                            /* 图片 */
                            var imageList = fullInfo.imageList;
                            if (imageList.length) {
                                var str = '';
                                for (var i = 0; i < imageList.length; i++) {
                                    str += '<div class="col-sm-6"><img class="img-responsive" name="imageList" src="' + imageList[i].fileUrl + '" alt="' + imageList[i].fileName + '"></div>'
                                }
                                $('#image-list').append(str).find('.img-responsive').viewer();
                            } else {
                                $('#image-list').append('<p style="margin-left: 0.6rem;">暂无数据！</p>');
                            }

                            /* 合同列表 */
                            var contractInfoList = fullInfo.contractInfoList;
                            if (contractInfoList.length) {
                                for (var i = 0; i < contractInfoList.length; i++) {
                                    $('#contract').find('table tbody').append('<tr>' +
                                        /*'<td class="text-center text-muted"><span $onclick="detailed(\'' + contractInfoList[i].id + '\',\'' + (contractInfoList[i].item || '') + '\')" target="_blank" class="btn btn-primary btn-xs underline" data-toggle="tooltip" title="详情"><i class="fa fa-file-text-o"></i></span></td>' +*/
                                        '<td class="text-center text-muted">' + (contractInfoList[i].contractName || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (contractInfoList[i].contractNo || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (contractInfoList[i].firstParty || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (contractInfoList[i].maintainerName || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (contractInfoList[i].item || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (contractInfoList[i].signDate || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (contractInfoList[i].contractContent || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (contractInfoList[i].startDate || '') + '~' + (contractInfoList[i].endDate || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (contractInfoList[i].contractAmount ? contractInfoList[i].contractAmount/100 : '') + '</td>' +
                                        '</tr>');
                                }
                            } else {
                                $('#contract').find('table tbody').html('<tr><td class="text-left text-muted" colspan="10">暂无数据！</td></tr>');
                            }

                            /* 调拨记录 */
                            var allotList = fullInfo.allotList;
                            if (allotList.length) {
                                for (var i = 0; i < allotList.length; i++) {
                                    $('#allot-list').find('table tbody').append('<tr>' +
                                        '<td class="text-center text-muted">' + (allotList[i].applyTime || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (allotList[i].department || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (allotList[i].applyName || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (allotList[i].deviceName || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (allotList[i].departmentName || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (allotList[i].approveName || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (allotList[i].approveTime || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (allotList[i].confirmTime || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (allotList[i].statusStr || '') + '</td>' +
                                        '</tr>');
                                }
                            } else {
                                $('#allot-list').find('table tbody').html('<tr><td class="text-left text-muted" colspan="9">暂无数据！</td></tr>');
                            }

                            /* 培训记录 */
                            var trainInfoList = fullInfo.trainInfoList;
                            if (trainInfoList.length) {
                                for (var i = 0; i < trainInfoList.length; i++) {
                                    $('#train-list').find('table tbody').append('<tr>' +
                                        '<td class="text-center text-muted">' + (trainInfoList[i].trainDate || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (trainInfoList[i].trainUnit || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (trainInfoList[i].trainPerson || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (trainInfoList[i].trainAddress || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (trainInfoList[i].attendPerson || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (trainInfoList[i].trainContent || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (trainInfoList[i].remark || '') + '</td>' +
                                        '</tr>');
                                }
                            } else {
                                $('#train-list').find('table tbody').html('<tr><td class="text-left text-muted" colspan="7">暂无数据！</td></tr>');
                            }

                            /* 附件列表 */
                            var attachmentList = fullInfo.attachmentList;
                            if (attachmentList.length) {
                                for (var i = 0; i < attachmentList.length; i++) {
                                    $('#attachment-list').find('table tbody').append('<tr>' +
                                        '<td class="text-center text-muted">' + (attachmentList[i].assetsName || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (attachmentList[i].model || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (attachmentList[i].assetsCode || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (attachmentList[i].remarks || '') + '</td>' +
                                        '</tr>');
                                }
                            } else {
                                $('#attachment-list').find('table tbody').html('<tr><td class="text-left text-muted" colspan="4">暂无数据！</td></tr>');
                            }

                            /* 维修记录 */
                            var repairList = fullInfo.repairList;
                            if (repairList.length) {
                                for (var i = 0; i < repairList.length; i++) {
                                    $('#repair-list').find('table tbody').append('<tr>' +
                                        '<td class="text-center text-muted">' +
                                        '<a href="<%=basePath%>/charts/assets/repair/page?id=' + repairList[i].id + '"' +
                                        'target="_blank" class="btn btn-primary btn-xs" data-toggle="tooltip" ' +
                                        'title="详情"><i class="fa fa-file-text-o"></i></a>' +
                                        '</td>' +
                                        '<td class="text-center text-muted">' + (repairList[i].repairTime || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (repairList[i].faultTime || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (repairList[i].completeTime || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (repairList[i].item || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (repairList[i].fault || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (repairList[i].repairCost ? parseFloat(repairList[i].repairCost/100).toFixed(2) : '') + '</td>' +
                                        '<td class="text-center text-muted">' + (repairList[i].maintainerName || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (repairList[i].partName || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (minuteUpper(repairList[i].repairUsedMin) || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (repairList[i].overallScore || '') + '</td>' +
                                        '</tr>');
                                }
                            } else {
                                $('#repair-list').find('table tbody').append('<tr><td class="text-center text-muted" colspan="11">暂无数据！</td></tr>');
                            }

                            /* 保养记录 */
                            var upkeepList = fullInfo.upkeepList;
                            if (upkeepList.length) {
                                for (var i = 0; i < upkeepList.length; i++) {
                                    $('#upkeep-list').find('table tbody').append('<tr>' +
                                       /* '<td class="text-center text-muted">' +
                                        '<a $href="<%=basePath%>/upkeep/getUpkeepList?upkeepId=' + upkeepList[i].id + '"' +                                            'target="_blank" class="btn btn-primary btn-xs" data-toggle="tooltip" title="详情' +
                                        '"><i class="fa fa-file-text-o"></i></a>' +
                                        '</td>' +*/
                                        '<td class="text-center text-muted">' + (upkeepList[i].upkeepDate || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (upkeepList[i].name || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (upkeepList[i].upkeepContent || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (upkeepList[i].comment  || '') + '</td>' +
                                        '</tr>');
                                }
                            } else {
                                $('#upkeep-list').find('table tbody').append('<tr><td class="text-center text-muted" colspan="6">暂无数据！</td></tr>');
                            }

                            /* 巡检记录 */
                            var inspectionList = fullInfo.inspectionList;
                            if (inspectionList.length) {
                                for (var i = 0; i < inspectionList.length; i++) {
                                    $('#inspection-list').find('table tbody').append('<tr>' +
                                        /*'<td class="text-center text-muted"><button type="button" ' +
                                        '$onclick="getInfo(' + inspectionList[i].id + ')" ' +
                                        'class="btn btn-primary btn-xs" ' +
                                        'data-toggle="tooltip" data-original-title="详情">' +
                                        '<i class="fa fa-file-text-o"></i></button>' +
                                        '</td>' +*/
                                        '<td class="text-center text-muted">' + (inspectionList[i].inspectionDate || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (inspectionList[i].inspectionPerson || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (inspectionList[i].remark || '') + '</td>' +
                                        '</tr>');
                                }
                            } else {
                                $('#inspection-list').find('table tbody').append('<tr><td class="text-center text-muted" colspan="4">暂无数据！</td></tr>');
                            }

                            /* 维修记录 */
                            var compulsoryVerificationList = fullInfo.compulsoryVerificationList;
                            if (compulsoryVerificationList.length) {
                                for (var i = 0; i < compulsoryVerificationList.length; i++) {
                                    $('#compulsory-list').find('table tbody').append('<tr>' +
                                       /* '<td class="text-center text-muted">' +
                                        '<button type="button" $onclick="getVerificationInfo(' + compulsoryVerificationList[i].id + ')" class="btn btn-primary btn-xs" data-toggle="tooltip" data-original-title="详情">' +
                                        '<i class="fa fa-file-text-o"></i>' +
                                        '</button>' +
                                        '</td>' +*/
                                        '<td class="text-center text-muted">' + (compulsoryVerificationList[i].verificationTime || '') +'</td>' +
                                        '<td class="text-center text-muted">' + (compulsoryVerificationList[i].verificationUnit || '') +'</td>' +
                                        '<td class="text-center text-muted">' + (compulsoryVerificationList[i].verificationPerson || '') +'</td>' +
                                        '</tr>');
                                }
                            } else {
                                $('#compulsory-list').find('table tbody').append('<tr><td class="text-center text-muted" colspan="4">暂无数据！</td></tr>');
                            }

                            /* 维修记录 */
                            var correctionInfoList = fullInfo.correctionInfoList;
                            if (correctionInfoList.length) {
                                for (var i = 0; i < correctionInfoList.length; i++) {
                                    $('#correction-list').find('table tbody').append('<tr>' +
                                        '<td class="text-center text-muted">' + (correctionInfoList[i].correctionDate || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (correctionInfoList[i].correctionUnit || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (correctionInfoList[i].correctionPerson  || '') + '</td>' +
                                        '<td class="text-center text-muted">' + (correctionInfoList[i].correctionReport  || '') + '</td>' +
                                        '</tr>');
                                }
                            } else {
                                $('#correction-list').find('table tbody').append('<tr><td class="text-center text-muted" colspan="4">暂无数据！</td></tr>');
                            }
                        }
                    }
                }
            });
        }

        function basicTrHtml(basic,id,code){
            var b ='';
            if(id == 32000 || id == 32001 || id == 32002){
                b = ''
            }else {
                b = 'none'
            }
            var html = '';
            var arr = chunk(basic, 3);
            $.each(arr, function(key, val){
                html += '<tr data-length="'+(arr.length)+'" style="display: '+b+'">'+basicTdHtml(val)+'</tr>'
            });
            return html;
        }

        //td
        function basicTdHtml(val){
            var html = '';
            $.each(val, function(key1, val1){
                html += '<td class="text-center"><label class="text-muted">'+val1.fieldName+'</label></td>\
                                    <td class="text-left"><span>'+val1.value+'</span></td>'
            });
            return html;
        }

        //数组切割公共方法
        function chunk(arr, num){
            num = num*1 || 1;
            var ret = [];
            arr.forEach(function(item, i){
                if(i % num === 0){
                    ret.push([]);
                }
                ret[ret.length - 1].push(item);
            });
            return ret;
        };

        /*
        * 根据参数名获取url中的参数
        * name  参数名
        * */
        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        }

        //将设备状态转换成文字
        function assetsStatusName(status) {
            var nameString = '';
            switch (status) {
                case 1:
                    nameString = '正常';
                    break;
                case 2:
                    nameString = '故障';
                    break;
                case 3:
                    nameString = '宕机';
                    break;
                default:
                    nameString = '';
            }
            return nameString;
        }

        //将使用状况转换成文字
        function useStatusName(status) {
            var nameString = '';
            switch (status) {
                case 1:
                    nameString = '在用';
                    break;
                case 2:
                    nameString = '故障';
                    break;
                case 3:
                    nameString = '闲置';
                    break;
                case 4:
                    nameString = '待报废';
                    break;
                case 5:
                    nameString = '其他';
                    break;
                default:
                    nameString = '';
            }
            return nameString;
        }

        //将使用方向转换成文字
        function useDirectionName(status) {
            var nameString = '';
            switch (status) {
                case 1:
                    nameString = '自用';
                    break;
                case 2:
                    nameString = '出租';
                    break;
                case 3:
                    nameString = '出借';
                    break;
                case 4:
                    nameString = '其他';
                    break;
                default:
                    nameString = '';
            }
            return nameString;
        }

        //将是否转换成文字
        function toText(value) {
            var text = '';
            if (value == 1) {
                text = '是';
            } else if (value == 0) {
                text = '否';
            } else {
                text = '';
            }
            return text;
        }

        //将单位转换成文字
        function unitName(id) {
            var nameString = '';
            switch (id) {
                case 1:
                    nameString = '套';
                    break;
                case 2:
                    nameString = '台';
                    break;
                case 3:
                    nameString = '件';
                    break;
                case 4:
                    nameString = '个';
                    break;
                case 5:
                    nameString = '辆';
                    break;
                default:
                    nameString = '';
            }
            return nameString;
        }

        //将外币单位转换成文字
        function foreignUnitName(id) {
            var nameString = '';
            switch (id) {
                case 1:
                    nameString = '美元';
                    break;
                case 2:
                    nameString = '英镑';
                    break;
                case 3:
                    nameString = '欧元';
                    break;
                case 4:
                    nameString = '日元';
                    break;
                default:
                    nameString = '';
            }
            return nameString;
        }

        //将资产取得方式转换成文字
        function assetsMethodName(id) {
            var nameString = '';
            switch (id) {
                case 1:
                    nameString = '购置';
                    break;
                case 2:
                    nameString = '部门内调剂';
                    break;
                case 3:
                    nameString = '接受捐赠';
                    break;
                case 4:
                    nameString = '置换';
                    break;
                case 5:
                    nameString = '主管部门调配';
                    break;
                case 6:
                    nameString = '部门外调入';
                    break;
                case 7:
                    nameString = '其他';
                    break;
                default:
                    nameString = '';
            }
            return nameString;
        }

        //将采购组织形式转换成文字
        function organizationMethodName(id) {
            var nameString = '';
            switch (id) {
                case 1:
                    nameString = '政府集中采购';
                    break;
                case 2:
                    nameString = '部门集中采购';
                    break;
                case 3:
                    nameString = '分散购买及其他';
                    break;
                default:
                    nameString = '';
            }
            return nameString;
        }

        //将采购方式转换成文字
        function organMethodName(id) {
            var nameString = '';
            switch (id) {
                case 1:
                    nameString = '公开招标';
                    break;
                case 2:
                    nameString = '邀请招标';
                    break;
                case 3:
                    nameString = '竞争性谈判';
                    break;
                case 4:
                    nameString = '单一来源采购';
                    break;
                case 5:
                    nameString = '询价';
                    break;
                case 6:
                    nameString = '其他';
                    break;
                default:
                    nameString = '';
            }
            return nameString;
        }

        //将周期单位转换成文字
        function cycleName(id) {
            var nameString = '';
            switch (id) {
                case 1:
                    nameString = '天';
                    break;
                case 2:
                    nameString = '周';
                    break;
                case 3:
                    nameString = '月';
                    break;
                default:
                    nameString = '';
            }
            return nameString;
        }

        //将分钟转换成最大周期
        function minuteUpper(min) {
            if (min && parseInt(min)) {
                min = parseInt(min);
                if (min / 60 / 24 > 1) {
                    return parseFloat(min / 60 / 24).toFixed(2) + '天';
                } else if (min / 60 > 1) {
                    return parseFloat(min / 60).toFixed(2) + '小时';
                } else {
                    return min + '分钟';
                }
            } else {
                return false;
            }
        }

        //将数字转换成带有千分符的数字
        function digitSplit(money) {
            if (money) {
                money = parseFloat(money / 100).toFixed(2);
                return money.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
            } else {
                return '';
            }
        }
        //预览文件及图片
        function preview(url, file) {
            $("#pdf-modal").iziModal({
                zindex: 999999,
                headerColor: '<%=path%>' == '/report' ? '#222431' : '#00c0ef',
                title: '预览',
                subtitle: file,
                overlayClose: true,
                history: false,
                iframe: true,
                iframeURL: url,
                fullscreen: true,
                openFullscreen: false,
                onClosed: function () {
                    $('#pdf-modal').iziModal('destroy');
                }
            });
            $("#pdf-modal").iziModal('open');
        }
        //查询合同信息详情以及合同下的设备信息,合同文件
        function detailed(id,item){
            if(id==null || id == ""){
                return;
            }
            var url = "<%=basePath%>";
            if(item == "采购合同"){
                // 采购合同详情
                window.location.href=url+"/contract/"+id;
            }else{
                // 维修合同详情
                window.location.href=url+"/contract/queryContractInfoById?id="+id;
            }
        }

        $("#repair-modal").iziModal({
            title:"维修记录",
            headerColor: '<%=path%>' == '/report' ? '#222431' : '#00c0ef',
            rtl: false,
            zindex: 1081,
            history: false,
            width: 1024,
            bodyOverflow: true,
            closeOnEscape: true,
            autoOpen: false,
            onOpening: function(){},
            onOpened: function(){},
            onClosing: function(){},
            onClosed: function(){
                $(".table-1,.table-2,.table-3,.table-4,.table-5").addClass("hide");
            }
        });
        function getMatainTimes(type){
            var modal = $("#repair-modal");
            if(type == 1){
                modal.iziModal('setTitle', '维修记录');
                $(".table-1").removeClass("hide");
            }else if(type == 2){
                modal.iziModal('setTitle', '保养记录');
                $(".table-2").removeClass("hide");
            }else if(type == 3){
                modal.iziModal('setTitle', '巡检记录');
                $(".table-3").removeClass("hide");
            }else if(type==4){
                modal.iziModal('setTitle', '强检记录');
                $(".table-4").removeClass("hide");
            }else{
                modal.iziModal('setTitle', '校正记录');
                $(".table-5").removeClass("hide");
            }
            modal.iziModal("open");
        }

        function getInfo(id){
            location.href="<%=basePath%>/polling/getInfo?id="+id;
        }

        function getVerificationInfo(id){
            location.href="<%=basePath%>/mandatory-testing/getInfo?id="+id;
        }

        var optionA = {
            color: ['#d8e8f2'],
            tooltip: {},
            radar: {
                name: {
                    textStyle: {
                        color: '#d8e8f2',
                        borderRadius: 3,
                        fontSize: 16
                    }
                },
                indicator: [
                    {name: '维修', max: 10},
                    {name: '强检', max: 10},
                    {name: '校正', max: 10},
                    {name: '保养', max: 10},
                    {name: '巡检', max: 10}
                ],
                center: ['50%', '50%'],
                radius: '67%',
                splitArea: {
                    areaStyle: {
                        color: [],
                        shadowColor: '#10458f',
                        shadowBlur: 10
                    }
                }
            },
            series: [{
                name: '运行情况',
                type: 'radar',
                symbol: 'roundRect',
                symbolSize: '1',
                itemStyle: {normal: {areaStyle: {type: 'default'}}},
                lineStyle: {
                    normal: {
                        color: "#3c8dbc"
                    }
                },
                data: [
                    {
                        value: [10, 10, 10, 10, 10],
                        name: '计划值',
                        lineStyle: {
                            normal: {
                                color: 'green'
                            }
                        },
                        areaStyle: {
                            normal: {
                                opacity: 0
                            }
                        }
                    },
                    {
                        value: [],
                        name: '运行情况'
                    }
                ]
            }]
        };
        var optionB1 = {
            title: {
                show: false,
                text: '收支情况'
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data: ['收入', '支出'],
                right: '4%',
                textStyle: {
                    fontSize: 12,
                    color: '<%=path%>' == '/report' ? '#F1F1F3' : '#000'
                }
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: [{
                type: 'category',
                boundaryGap: false,
                axisLine: {
                    lineStyle: {
                        color: '<%=path%>' == '/report' ? '#fff' : '#000'
                    }
                },
                data: []
            }],
            yAxis: [{
                type: 'value',
                name: '费用：万元',
                axisTick: {
                    show: false
                },
                axisLine: {
                    lineStyle: {
                        color: '<%=path%>' == '/report' ? '#fff' : '#000'
                    }
                },
                axisLabel: {
                    margin: 10,
                    textStyle: {
                        fontSize: 14
                    }
                },
                splitLine: {
                    lineStyle: {
                        color: '#57617B'
                    }
                }
            }],
            series: [{
                name: '收入',
                type: 'line',
                smooth: true,
                symbol: 'circle',
                symbolSize: 5,
                showSymbol: false,
                lineStyle: {
                    normal: {
                        width: 1
                    }
                },
                areaStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: 'rgba(52, 139, 15, 1)'
                        }, {
                            offset: 0.8,
                            color: 'rgba(52, 139, 15, 0.4)'
                        }], false)
                    }
                },
                itemStyle: {
                    normal: {
                        color: 'rgb(137,189,27)',
                        borderColor: 'rgba(137,189,2,0.27)',
                        borderWidth: 12

                    }
                },
                data: []
            }, {
                name: '支出',
                type: 'line',
                smooth: true,
                symbol: 'circle',
                symbolSize: 5,
                showSymbol: false,
                lineStyle: {
                    normal: {
                        width: 1
                    }
                },
                areaStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: 'rgba(0, 136, 212, 0.3)'
                        }, {
                            offset: 0.8,
                            color: 'rgba(0, 136, 212, 0)'
                        }], false),
                        shadowColor: 'rgba(0, 0, 0, 0.1)',
                        shadowBlur: 10
                    }
                },
                itemStyle: {
                    normal: {
                        color: 'rgb(0,136,212)',
                        borderColor: 'rgba(0,136,212,0.2)',
                        borderWidth: 12

                    }
                },
                data: []
            }]
        };
        var optionB2 = {
            title: {
                show: false,
                text: '维修情况'
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data: ['维修费用', '维修次数'],
                right: '4%',
                textStyle: {
                    fontSize: 12,
                    color: '<%=path%>' == '/report' ? '#F1F1F3' : '#000'
                }
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis: [{
                type: 'category',
                boundaryGap: false,
                axisLine: {
                    lineStyle: {
                        color: '<%=path%>' == '/report' ? '#fff' : '#000'
                    }
                },
                data: []
            }],
            yAxis: [{
                type: 'value',
                name: '费用：万元',
                axisTick: {
                    show: false
                },
                axisLine: {
                    lineStyle: {
                        color: '<%=path%>' == '/report' ? '#fff' : '#000'
                    }
                },
                axisLabel: {
                    margin: 10,
                    textStyle: {
                        fontSize: 14
                    }
                },
                splitLine: {
                    lineStyle: {
                        color: '#57617B'
                    }
                }
            }, {
                type: 'value',
                name: '次数',
                axisTick: {
                    show: false
                },
                axisLine: {
                    lineStyle: {
                        color: '<%=path%>' == '/report' ? '#fff' : '#000'
                    }
                },
                axisLabel: {
                    margin: 10,
                    textStyle: {
                        fontSize: 14
                    }
                },
                splitLine: {
                    show: false
                }
            }],
            series: [{
                name: '维修费用',
                type: 'line',
                smooth: true,
                symbol: 'circle',
                symbolSize: 5,
                showSymbol: false,
                lineStyle: {
                    normal: {
                        width: 1
                    }
                },
                areaStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: 'rgba(52, 139, 15, 1)'
                        }, {
                            offset: 0.8,
                            color: 'rgba(52, 139, 15, 0.4)'
                        }], false)
                    }
                },
                itemStyle: {
                    normal: {
                        color: 'rgb(137,189,27)',
                        borderColor: 'rgba(137,189,2,0.27)',
                        borderWidth: 12

                    }
                },
                data: []
            }, {
                name: '维修次数',
                type: 'line',
                yAxisIndex: 1,
                smooth: true,
                symbol: 'circle',
                symbolSize: 5,
                showSymbol: false,
                lineStyle: {
                    normal: {
                        width: 1
                    }
                },
                areaStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                            offset: 0,
                            color: 'rgba(0, 136, 212, 0.3)'
                        }, {
                            offset: 0.8,
                            color: 'rgba(0, 136, 212, 0)'
                        }], false),
                        shadowColor: 'rgba(0, 0, 0, 0.1)',
                        shadowBlur: 10
                    }
                },
                itemStyle: {
                    normal: {
                        color: 'rgb(0,136,212)',
                        borderColor: 'rgba(0,136,212,0.2)',
                        borderWidth: 12

                    }
                },
                data: []
            }]
        };
    </script>
    </body>
</fmt:bundle>
</html>
